package org.jeecg.common.Enum;

/**
 *  通用枚举类
 */
public class CouponEnums {
    /**
     * O 否 1是 枚举
     */
    public static enum TRUEORFALSE{
        TRUE(1,"是"), FALSE(0,"否");

        int code = 0;
        String value = "";

        private TRUEORFALSE(int code,String value){
            this.code = code;
            this.value = value;
        }

        public int code(){
            return code;
        }

        public String getValue(){
            return value;
        }

        //根据CODE获取类型
        public static TRUEORFALSE val(int vcode){
            for(TRUEORFALSE bld: values()){
                if(bld.code == vcode){
                    return bld;
                }
            }
            return FALSE;
        }

        public static TRUEORFALSE val(String value){
            for(TRUEORFALSE bld : values()){
                if(bld.value.equals(value)){
                    return bld;
                }
            }
            return FALSE;
        }
    }
}
